package com.examples.spider.processor;

import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.model.ConsolePageModelPipeline;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.annotation.ExtractBy;
import us.codecraft.webmagic.model.annotation.ExtractByUrl;
import us.codecraft.webmagic.model.annotation.TargetUrl;

import java.util.List;


@TargetUrl("https://www.xxbiquge.com/31_31906/")
public class BookRepo {

    @ExtractBy(value = "//div[@id='list']/dl/dt/text()")
    private String name;

    @ExtractBy(value ="//div[@id='list']/dl/dd/a/text()")
    private List<String> chapters;

    @ExtractBy(value = "//div[@id='list']/dl/dd/a/@href")
    private List<String> chapterLinks;


    public static void main(String[] args) {
        OOSpider.create(Site.me().setSleepTime(1000),new ConsolePageModelPipeline(), BookRepo.class).addUrl("https://www.xxbiquge.com/31_31906/").run();
    }


}
